package com.woniu.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.model.BmsPermission;
import com.woniu.model.BmsUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-04-13
 */
public interface BmsPermissionMapper extends BaseMapper<BmsPermission> {
    @Select("select bp.* from bms_dept_permission bdp left join bms_permission bp on bdp.permission_id=bp.id where bdp.dept_id=#{deptId} union select bp.* from bms_user_role bur left join bms_permission_role bpr on bur.role_id= bpr.role_id join bms_permission bp on bpr.permission_id=bp.id where bur.user_id=#{id} union select bp.* from bms_user_permission bup left join bms_permission bp on bup.permision_id=bp.id where bup.uid=#{id}")
    List<BmsPermission> queryAllMenuPermission(BmsUser bmsUser);

}
